
#scan 自动化测试工具，很好的封装了 Unit Test
#sigh 针对于 iOS 项目开发证书和 Provision file 的下载工具
#match 同步团队每个人的证书和 Provision file 的超赞工具
#gym 针对于 iOS 编译打包生成 ipa 文件
#deliver 用于上传应用的二进制代码，应用截屏和元数据到 App Store
#snapshot 可以自动化iOS应用在每个设备上的本地化截屏过程

default_platform(:ios)

platform :ios do

    before_all do
        # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
        cocoapods
    end

    desc "UI 测试"
    lane :test do
        scan
    end

    desc "提交一个新的Beta版本到 Apple TestFlight"
    desc "This will also make sure the profile is up to date"
    lane :beta do
        # match(type: "appstore") # more information: https://codesigning.guide
        gym(scheme: "Docment") # Build your app - more options available
        pilot
         # sh "your_script.sh"
    end

    desc "部署一个新版本到App Store"
    lane :release do
        # match(type: "appstore")
        # snapshot
        gym(scheme: "Docment") # Build your app - more options available
        deliver(force: true)
        # frameit
    end

    # 你可以定义自己的lane
    #执行lane成功后的回调
    after_all do |lane|
        # slack(
        #   message: "Successfully deployed new App Update."
        # )
    end

    # 如果流程发生异常会走这里并终止
    error do |lane, exception|
        # slack(
        #   message: exception.message,
        #   success: false
        # )
    end

      desc "企业版"
      lane :inHouse do
        # 调用  prepare 任务
        prepare

         gym(scheme: "KKKKK",
            export_method:"enterprise",
            # output_directory: "./build", # 打包后的 ipa 文件存放的目录
            output_name: "KKKKK" , # ipa 文件名
						include_bitcode: false
         )
         #pgyer
         pgyer(api_key:"c58c79021200ef0d7e1eec6b8a7421be",user_key:"dd78b963d87ce03001c5f687e019b9b0",
         update_description:"fastlane自动打包上传测试",
         password:"123446", # 安装密码
         install_type:"2")  # 安装类型
      end


    desc "抽离调用"
    lane :prepare do
        cocoapods
    end

end
